"""
ASGI config for django_socket project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os

from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application

from rent_pro import routing1

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_socket.settings')

# application = get_asgi_application()

#修改配置，使django支持websocket协议（之前仅支持http协议）
application = ProtocolTypeRouter({
    "http": get_asgi_application(),
    "websocket": URLRouter(routing1.websocket_urlpatterns)#routing相当于之前的urls
})